/*
 * BookState.java
 *
 *  created: 9.11.2011
 *  charset: UTF-8
 *  license: MIT (X11) (See LICENSE file for full license)
 */
package cz.mp.k3bg;

import cz.mp.k3bg.core.BookFiles;
import cz.mp.k3bg.core.KindlegenRunner;
import cz.mp.k3bg.core.Metadata;
import cz.mp.k3bg.log.LoggerManager;
import java.util.logging.Logger;


/**
 * Pomocná třída, která "drží stav programu".
 * 
 * @author Martin Pokorný
 * @version 0.1
 */
public class BookState {

    private static final boolean DEBUG = false;
    private static final Logger logger =
            LoggerManager.getLogger(BookState.class, DEBUG);
    
    private static BookState mainInstance = null;
    
    
    private Metadata metadata = null;
    
    private BookFiles bookFiles = null;
    
    private KindlegenRunner kindlegenRunner = null;
    
    // -----    
    
    /** */
    public BookState() {
    }

    /**
     * 
     * @return 
     */
    public static BookState getMainInstance() {
        if (mainInstance == null) {
            logger.fine("new!");
            mainInstance = new BookState();
        }
        return mainInstance;
    }
    
    /**
     * 
     * @param book 
     */
    public static void setBookInstance(BookState book) {
        logger.fine("");
        mainInstance = book;
    }
    
    /**
     * 
     * @param bookFiles 
     */
    public void setBookFiles(BookFiles bookFiles) {
        if (bookFiles == null) {
            logger.fine("null");
        }
        else {
            logger.fine("");
        }
        this.bookFiles = bookFiles;
    }

    /**
     * 
     * @return 
     */
    public BookFiles getBookFiles() {
        return bookFiles;
    }

    /**
     * 
     * @param metadata 
     */
    public void setMetadata(Metadata metadata) {
        if (metadata == null) {
            logger.fine("null");
        }
        else {
            logger.fine("");
        }
        this.metadata = metadata;
    }
    
    /**
     * 
     * @return 
     */
    public Metadata getMetadata() {
        return metadata;
    }

    /**
     * 
     * @param kindlegenRunner 
     */
    public void setKindlegenRunner(KindlegenRunner kindlegenRunner) {
        if (kindlegenRunner == null) {
            logger.fine("null");
        }
        else {
            logger.fine("");
        }
        this.kindlegenRunner = kindlegenRunner;
    }

    /**
     *
     * @return
     */
    public KindlegenRunner getKindlegenRunner() {
        return kindlegenRunner;
    }


    /**
     * 
     */
    public void clear() {
        logger.fine("");
        this.metadata = null;
        this.bookFiles = null;
        this.kindlegenRunner = null;
    }
    
}   // BookState.java

